-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paragraph: store subscription for selected block only #56967
Conversation
Size Change: +81 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in f8e2b8c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7178178106
|
</InspectorControls> | ||
) } | ||
<InspectorControls group="typography"> | ||
<DropCapControl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you think the useSetting call is more expensive than rendering InspectorControls
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh the useSetting is only done for the selected block now. Makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because (1) drop cap is supported by default and (2) individual InspectorControls instances no longer make select calls but read from context instead, so they're much cheaper.
Creative. :) |
What?
I know changing block for performance is generally frowned upon, but hear me out:
ParagraphRTLControl
.InspectorControls
orBlockControls
so it's only for the select block: for example list item'sIndentUI
.Why?
Every useSelect added to a (frequestly used) block will degrade the load and type bit. By moving it within InspectorControls, the subscription is now only added for the selected block(s).
How?
Moving it with InspectorControls ensures it's only added when the block is selected.
Testing Instructions
Load (first block)
First run: -4.25%
Second run: -3.85%
Testing Instructions for Keyboard
Screenshots or screencast